< previous page page_42 next page >

Page 42
Although controls have been around since the beginning of Visual Basic, the capability to create your own controls did not exist until version 5. Visual Basic now allows you to create your own ActiveX controls for use in your programs and in any other program that adheres to ActiveX standards.
Control Functions
You can think of a control as a miniature program in itself that performs certain tasks for you. For example, the text box correctly sizes and displays the text based on the property values that you assign. Also, a text box contains internal code that allows it to process keystrokes so that it knows, for example, to erase a character when you press the Backspace key. If you wrote programs in earlier languages, particularly in the DOS and mainframe environments, you know that you might have had to write a significant amount of code just to accept and process keystrokes that allowed the users to enter input. Now you can just drop a control on your form, and the rest is done for you. In other words, controls are prepackaged objects that perform specific tasks.
Visual Basic 6 comes with a standard set of controls that are available in all editions and that let you perform many types of programming tasks. These controls are illustrated in the Toolbox shown in Figure 3.2. The use and purpose of these standard controls are discussed in Chapter 4, "Using Visual Basic's Default Controls."
0042-01.jpg
Figure 3.2
Visual Basic's Toolbox
contains a standard set of controls.
note.gif The standard controls that automatically appear in the Toolbox shown in Figure 3.2 are not the only ones included with Visual Basic. To add other controls, such as the TreeView control or ImageList control, use the Components dialog box by choosing Components from the Project menu.
sarrow.gifSee "Using the TreeView Control," p. 258 square.gif

Exploring Properties
In Chapter 2, "Creating Your First Program," you saw how to set an object's properties to modify its appearance when your program runs. Think of a property as an adjective that describes one specific thing about an object. By changing the value of one or more properties,

 
< previous page page_42 next page >